package com.ruibang.glass.material.controller;

import com.ruibang.glass.material.domain.req.MaterialDullnessReq;
import com.ruibang.glass.material.domain.req.MaterialInAndOutRecordReq;
import com.ruibang.glass.material.domain.req.MaterialManagementReq;
import com.ruibang.glass.material.domain.req.MaterialRQDullnessReq;
import com.ruibang.glass.material.entity.ycl.MaterialManagementInventory;
import com.ruibang.glass.material.service.MaterialDullnessService;
import com.ruibang.glass.material.service.MaterialInAndOutRecordsService;
import com.teaming.cloud.framework2.common.model.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 出入库呆滞统计
 * </p>
 *
 * @author mameng
 * @since 2024-04-28
 */
@RestController
@RequestMapping("/api/material/dullness")
@Api(value = "出入库呆滞统计", tags = {"出入库呆滞统计"})
public class MaterialDullnessController {
    @Autowired
    private MaterialDullnessService materialDullnessService;

    @PostMapping("/list")
    @ApiOperation(value = "全模块呆滞", response = ResultBody.class)
    public ResultBody getPageList(@RequestBody MaterialDullnessReq materialDullnessReq) {
        return ResultBody.success(materialDullnessService.getDullnessPage(materialDullnessReq));
    }

    @PostMapping("/getBcpList")
    @ApiOperation(value = "半成品呆滞", response = ResultBody.class)
    public ResultBody getBcpPageList(@RequestBody MaterialDullnessReq materialDullnessReq) {
        return ResultBody.success(materialDullnessService.getBcpDullnessPage(materialDullnessReq));
    }

    @PostMapping("/getCpList")
    @ApiOperation(value = "成品呆滞", response = ResultBody.class)
    public ResultBody getCpPageList(@RequestBody MaterialDullnessReq materialDullnessReq) {
        return ResultBody.success(materialDullnessService.getCpDullnessPage(materialDullnessReq));
    }

    @PostMapping("/getWarehouseDullnessList")
    @ApiOperation(value = "仓库出入库呆滞统计", response = ResultBody.class)
    public ResultBody getWarehouseDullnessList(@RequestBody MaterialDullnessReq materialDullnessReq) {
        return ResultBody.success(materialDullnessService.getWarehouseDullnessList(materialDullnessReq));
    }

    /**
     * 容器呆滞统计
     *
     * @param materialRQDullnessReq
     * @return
     */
    @PostMapping("/getRqDullnessList")
    @ApiOperation(value = "容器呆滞统计", response = ResultBody.class)
    public ResultBody getRqDullnessList(@RequestBody MaterialRQDullnessReq materialRQDullnessReq) {
        return ResultBody.success(materialDullnessService.getRqDullnessList(materialRQDullnessReq));
    }


    @PostMapping("/getMaterialDullnessList")
    @ApiOperation(value = "物品呆滞统计", response = ResultBody.class)
    public ResultBody getMaterialDullnessList(@RequestBody MaterialDullnessReq materialDullnessReq) {
        return ResultBody.success(materialDullnessService.getMaterialDullnessList(materialDullnessReq));
    }


    @PostMapping("/updateGD")
    @ApiOperation(value = "出入库统计归档", response = ResultBody.class)
    public ResultBody updateGD(@RequestBody MaterialManagementInventory materialManagementInventory) {
        materialDullnessService.updateGD(materialManagementInventory);
        return ResultBody.success();
    }

    @PostMapping("/updateCPGD")
    @ApiOperation(value = "出入库成品归档", response = ResultBody.class)
    public ResultBody updateCPGD(@RequestBody MaterialManagementInventory materialManagementInventory) {
        materialDullnessService.updateCPGD(materialManagementInventory);
        return ResultBody.success();
    }
    @PostMapping("/updateBCPGD")
    @ApiOperation(value = "出入库半成品归档", response = ResultBody.class)
    public ResultBody updateBCPGD(@RequestBody MaterialManagementInventory materialManagementInventory) {
        materialDullnessService.updateBCPGD(materialManagementInventory);
        return ResultBody.success();
    }

}
